import { defineStore } from "pinia";
import { reqTMList } from "@/api/trademark";
import type { tmLlistType } from "@/api/trademark";

export interface TMStoreStateType {
  TMList: tmLlistType;
  page: number;
  total: number;
}

const useTMListStore = defineStore("TMList", {
  state: (): TMStoreStateType => {
    return {
      TMList: [],
      page: 0,
      total: 0,
    };
  },
  actions:{
    async getTM(page:number,limit:number){
        try{
            const re = await reqTMList(page,limit)
            this.TMList = re.records
            this.page = re.pages
            this.total = re.total
        }catch(e){
            return Promise.reject(e)
        }
    }

    
  }
});

export default useTMListStore
